import { container } from "tsyringe";
import { CLOUD_HOST, CLOUD_PORT, CONFIG, CURRENT_PACKAGE, DEVICE_UUID, SCRIPT_MANAGER, SENDER, TASK, TOKEN } from "./tokens";
import { Sender } from "./autox/sender";
import { Config } from "./autox/config";
import { ScriptManager } from "./autox/scriptManager";
import { Task } from "./autox/task";

container.register(SENDER, Sender)
container.register(SCRIPT_MANAGER, ScriptManager)
container.register(CONFIG, Config);
container.register(SENDER, Sender);
container.register(TASK, Task);
container.register(DEVICE_UUID, {
    useFactory: (c) => {
        const config = c.resolve(Config)
        return config.get(DEVICE_UUID)
    }
});
container.register(CLOUD_HOST, {
    useValue: '60.204.248.43',
    // useValue: `192.168.102.8`
});
container.register(CLOUD_PORT, {
    useValue: 3102
});
container.register(TOKEN, {
    useFactory: (c) => {
        const config = c.resolve(Config)
        return config.get(TOKEN)
    }
});
container.register(CURRENT_PACKAGE, {
    useFactory: () => {
        return selector().findOne().packageName()
    }
});

